<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta content="width=device-width, initial-scale=1.0" name="viewport">

    <title>MOOC oriented Data Analysis System - Word</title>
    <meta content="" name="descriptison">
    <meta content="" name="keywords">


    <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
    <!-- Favicons -->
    <link href="static/assets/img/favicon.png" rel="icon">
    <link href="static/assets/img/apple-touch-icon.png" rel="apple-touch-icon">

    <!-- Google Fonts -->
    <link href="https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,600,600i,700,700i|Raleway:300,300i,400,400i,600,600i,700,700i,900"
          rel="stylesheet">

    <!-- Vendor CSS Files -->
    <link href="static/assets/vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
    <link href="static/assets/vendor/icofont/icofont.min.css" rel="stylesheet">
    <link href="static/assets/vendor/boxicons/css/boxicons.min.css" rel="stylesheet">
    <link href="static/assets/vendor/animate.css/animate.min.css" rel="stylesheet">
    <link href="static/assets/vendor/venobox/venobox.css" rel="stylesheet">
    <link href="static/assets/vendor/aos/aos.css" rel="stylesheet">

    <!-- Template Main CSS File -->
    <link href="static/assets/css/style.css" rel="stylesheet">

    <!-- =======================================================
    * Template Name: Mamba - v2.0.1
    * Template URL: https://bootstrapmade.com/mamba-one-page-bootstrap-template-free/
    * Author: BootstrapMade.com
    * License: https://bootstrapmade.com/license/
    ======================================================== -->
</head>

<body>
<!-- ======= Header ======= -->
<header id="header">
    <div class="container">

        <div class="logo float-left">
            <h1 class="text-light"><a href="index.html"><span>MOOC</span></a></h1>
            <!-- Uncomment below if you prefer to use an image logo -->
            <!-- <a href="index.html"><img src="static/assets/img/logo.png" alt="" class="img-fluid"></a>-->
        </div>

        <nav class="nav-menu float-right d-none d-lg-block">
            <ul>
                <li><a href="/index" style="font-size: 24px">首页</a></li>
                <li><a href="/exercise" style="font-size: 24px">练习</a></li>
                <li><a href="/problemlogs" style="font-size: 24px">日志</a></li>
                <li  class="active"><a href="/recommend" style="font-size: 24px">应用</a></li>
            </ul>
        </nav><!-- .nav-menu -->

    </div>
</header><!-- End Header -->

<!-- ======= About Us Section ======= -->
<section id="about" class="about font-color">
    <div class="section-title">
        <h2>个人做题词云分析</h2>
    </div>

    <div class="container">
        <div class="section-title">

            <form action="/searchById" method="post"
                  style="font-size: 18px;position: absolute;top: 252px;left: 408px;z-index: 1">
                <span class="font-color">学号：</span><input type="text" name="uid" class="input-text font-color">
                <button type="submit" class="btn btn-outline-info" style="height: 38px;margin-bottom: 4px;">查询</button>
            </form>

            <button id="btn1" type="button" class="btn btn-outline-info" value="点击显示"
                    style="position: absolute;left:1000px;top: 257px;z-index: 1">说明
            </button>
            <div id="explanation1"
                 style="width: 300px;position:absolute;right:140px;top:192px;z-index: 1"
                 class="border-explanation hide">
                <p style="margin: 5px 8px; font-style: normal" class="font-color">
                    说明：默认显示做题数最多学生的词云图，手动输入学号可查询其他同学的词云图，
                    分析出该同学喜欢的题目类型，帮助老师了解学生的做题特征，然后做出针对性调整。</p>
            </div>

            <button id="btn2" type="button" class="btn btn-outline-info" value="点击显示"
                    style="position: absolute; left: 900px;top: 257px;z-index: 1">学生列表
            </button>
            <div id="explanation2" style="width: 300px;position:absolute;left:760px;top:300px;z-index: 1"
                 class="border-explanation hide">
                <p style="margin: 5px 8px;" class="font-color">
                    [88703, 84690, 161155, 141387, 65067, 93643, 67549, 172560, 147397, 3613, 214633, 52938, 130607, 48707, 67308, 93407, 229591, 233235, 44854, 221241]</p>
            </div>

        </div>
        <div class="row no-gutters">


            <div class="col-lg-6 video-box">
                <img src="static/assets/img/word_cloud/学号：{{ your_id }}最喜欢的题目.jpg" class="img-fluid" alt="">
            </div>

            <div class="col-lg-6 video-box">
                <img src="static/assets/img/word_cloud/学号：{{ your_id }}最喜欢的领域及话题.jpg" class="img-fluid" alt="">
            </div>


        </div>

    </div>
</section><!-- End About Us Section -->

<section id="about" class="about">
    <div class="section-title">
        <h2>基于学生的练习推荐</h2>
    </div>

    <div class="container">

        <div id="app" class="row no-gutters">
            <p class="font-color" style="font-size: 18px;margin:15px 180px 15px 30px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;您的学号为
                <span v-text="your_id"></span> ,经过计算，在做题数量前20名的同学中，学号为<span
                        v-text="rec_stu_id"></span>的同学与您最为相似，相似度达到<span v-text="rec_similarity"></span> ，遂将他/她做过的<span
                        v-text="len"></span>道题目推荐给您。</p>
            <table id="table-1" style="width: 100%; margin: 10px auto;font-size: 18px">
                <tr>
                    <th>练习</th>
                    <th>中文名</th>
                    <th>所属领域</th>
                    <th>所属话题</th>
                    <th>难度系数</th>
                    <th>正确率</th>
                </tr>
                <tr v-for="exercise in rec_exercises">
                    <td v-text="exercise.name"></td>
                    <td v-text="exercise.name_cn"></td>
                    <td v-text="exercise.area"></td>
                    <td v-text="exercise.topic"></td>
                    <td v-text="exercise.diff"></td>
                    <td v-text="exercise.correct_rate"></td>
                </tr>

            </table>
        </div>

        <button id="btn3" type="button" class="btn btn-outline-info" value="点击显示"
                style="position: absolute; left: 1160px;top: 892px;z-index: 1">说明
        </button>
        <div id="explanation3" style="width: 300px;position:absolute;left:1192px;top:686px;z-index: 1"
             class="border-explanation hide">
            <p style="margin: 5px 8px;" class="font-color">
                说明：借鉴了基于用户的协同过滤算法思想，该推荐系统基于学生的做题记录，计算推荐学生与被推荐学生之间的相似度，将具有最大相似度的另一名同学
            推荐给该同学，推荐的练习题具体信息如下，以供该同学参考练习，迅速提升成绩。默认给做题数量最多的同学进行推荐，题目难度系数=1-正确率。</p>
        </div>

    </div>
</section><!-- End About Us Section -->

<!-- ======= Footer ======= -->
<footer id="footer">
    <div class="container">
        <div class="copyright">
            &copy; Copyright <strong><span>Mamba</span></strong>. All Rights Reserved
        </div>
        <div class="credits">
            <!-- All the links in the footer should remain intact. -->
            <!-- You can delete the links only if you purchased the pro version. -->
            <!-- Licensing information: https://bootstrapmade.com/license/ -->
            <!-- Purchase the pro version with working PHP/AJAX contact form: https://bootstrapmade.com/mamba-one-page-bootstrap-template-free/ -->
            Designed by <a href="https://bootstrapmade.com/">BootstrapMade</a>
        </div>
    </div>
</footer><!-- End Footer -->

<a href="#" class="back-to-top"><i class="icofont-simple-up"></i></a>

</body>
<!-- Vendor JS Files -->
<script src="static/assets/vendor/jquery/jquery.min.js"></script>
<script src="static/assets/vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
<script src="static/assets/vendor/jquery.easing/jquery.easing.min.js"></script>
<script src="static/assets/vendor/php-email-form/validate.js"></script>
<script src="static/assets/vendor/jquery-sticky/jquery.sticky.js"></script>
<script src="static/assets/vendor/venobox/venobox.min.js"></script>
<script src="static/assets/vendor/waypoints/jquery.waypoints.min.js"></script>
<script src="static/assets/vendor/counterup/counterup.min.js"></script>
<script src="static/assets/vendor/isotope-layout/isotope.pkgd.min.js"></script>
<script src="static/assets/vendor/aos/aos.js"></script>
<script src="../static/assets/js/vue-2.4.0.js"></script>

<!-- Template Main JS File -->
<script src="static/assets/js/main.js"></script>
<script>
    var btn1 = document.getElementById("btn1");
    var explanation1 = document.getElementById("explanation1");
    var btn2 = document.getElementById("btn2");
    var explanation2 = document.getElementById("explanation2");
    var btn3 = document.getElementById("btn3");
    var explanation3 = document.getElementById("explanation3");

    btn1.onclick = function () {
        //如果元素div当前是显示的, 就让他隐藏
        if (btn1.value === "点击隐藏") {
            explanation1.classList.add("hide");
            btn1.value = "点击显示";
        } else {
            explanation1.classList.remove("hide");
            btn1.value = "点击隐藏";
        }
    };

    btn2.onclick = function () {
        //如果元素div当前是显示的, 就让他隐藏
        if (btn2.value === "点击隐藏") {
            explanation2.classList.add("hide");
            btn2.value = "点击显示";
        } else {
            explanation2.classList.remove("hide");
            btn2.value = "点击隐藏";
        }
    };

    btn3.onclick = function () {
        //如果元素div当前是显示的, 就让他隐藏
        if (btn3.value === "点击隐藏") {
            explanation3.classList.add("hide");
            btn3.value = "点击显示";
        } else {
            explanation3.classList.remove("hide");
            btn3.value = "点击隐藏";
        }
    };

</script>


<script>
    new Vue({
        el: '#app',
        data: {
            rec_exercises:{{ exercises|safe }},
            rec_similarity: {{similarty}},
            rec_stu_id: {{ stu_id }},
            your_id: {{ your_id }},
            len:{{ len }}
        },
        created: function () {
            //为了在内部函数能使用外部函数的this对象，要给它赋值了一个名叫self的变量。
            var self = this;
            $.ajax({
                url: '/word',
                type: 'get',
                data: {},
                dataType: 'json'
            }).then(function (res) {
                console.log(res);
                //把从json获取的数据赋值给数组
                self.sites = res;
            }).fail(function () {
                console.log('失败');
            })
        }
    })
</script>

</html>